package com.example.idachuappone.person.member;

import java.util.ArrayList;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.example.idachuappone.BaseActivity;
import com.example.idachuappone.MainTWo;
import com.example.idachuappone.R;
import com.example.idachuappone.cook.item.PayPromptlyActivity;
import com.example.idachuappone.index.alipay.Result;
import com.example.idachuappone.index.ui.MyListView;
import com.example.idachuappone.index.weixinpay.Constants;
import com.example.idachuappone.person.entity.MemberTypee;
import com.example.idachuappone.person.entity.MemberYouHui;
import com.example.idachuappone.person.item.LoginActivity;
import com.example.idachuappone.utils.AppShareData;
import com.example.idachuappone.utils.BitmapUtilHelper;
import com.example.idachuappone.utils.CheckUtil;
import com.example.idachuappone.utils.Constant;
import com.example.idachuappone.utils.CusProSmallBgDialog;
import com.example.idachuappone.utils.MainToast;
import com.example.idachuappone.utils.NetUtil;
import com.example.idachuappone.utils.PrefUtil;
import com.lidroid.xutils.BitmapUtils;
import com.lidroid.xutils.bitmap.BitmapGlobalConfig.BitmapCacheManagementTask;
import com.lidroid.xutils.exception.HttpException;
import com.lidroid.xutils.http.ResponseInfo;
import com.lidroid.xutils.http.callback.RequestCallBack;
import com.tencent.mm.sdk.modelpay.PayReq;
import com.tencent.mm.sdk.openapi.IWXAPI;
import com.tencent.mm.sdk.openapi.WXAPIFactory;

public class MemberDetailActivity extends BaseActivity implements OnClickListener {
	private static final int RQF_PAY = 290;
	public static int code;
	private IWXAPI api;
	private Button btn_back;
	private Button btn_ok;
	private BitmapUtils bu;
	private CusProSmallBgDialog cusProDialog;
	private Handler handler;
	private String id;
	private ImageView img_alipay;
	private ImageView img_member_kapian;
	private ImageView img_member_on_off;
	private ImageView img_weixin;
	private boolean is_open_close;
	private boolean ispayprompty;
	private List<MemberYouHui> lists;
	private LinearLayout ll_alipay;
	private LinearLayout ll_member_on_off;
	private LinearLayout ll_weixin;
	private int memberType;
	private MemberTypee memberTypee;
	private MyListView mlv_main;
	private MyAdapter myAdapter;
	private int payType;
	private RelativeLayout rl_bg;
	private TextView tv_title;
	private TextView tv_youhui_price;

	class AnonymousClass_4 extends Thread {
		private final/* synthetic */String val$info;

		AnonymousClass_4(String str) {
			this.val$info = str;
		}

		@Override
		public void run() {
			String result = "";// new AliPay(MemberDetailActivity.this,
								// MemberDetailActivity.this.handler).pay(this.val$info);
			Message msg = MemberDetailActivity.this.handler.obtainMessage(RQF_PAY);
			msg.obj = result;
			MemberDetailActivity.this.handler.sendMessage(msg);
		}
	}

	private static class GetPrepayIdResult {
		private static final String TAG = "MicroMsg.SDKSample.PayActivity.GetPrepayIdResult";
		public int errCode;
		public String errMsg;
		public LocalRetCode localRetCode;
		public String noncestr;
		public String prepayId;
		public String sign;
		public String timestamp;

		private GetPrepayIdResult() {
			this.localRetCode = LocalRetCode.ERR_OTHER;
		}

		public void parseFrom(String content) {
			if (content == null || content.length() <= 0) {
				Log.e(TAG, "parseFrom fail, content is null");
				this.localRetCode = LocalRetCode.ERR_JSON;
				return;
			}
			try {
				JSONObject json = new JSONObject(content);
				if (json.has("data")) {
					this.prepayId = json.getJSONObject("data").getString("prepayid");
					this.sign = json.getJSONObject("data").getString("sign");
					this.noncestr = json.getJSONObject("data").getString("noncestr");
					this.timestamp = json.getJSONObject("data").getString("timestamp");
					this.localRetCode = LocalRetCode.ERR_OK;
				} else {
					this.localRetCode = LocalRetCode.ERR_JSON;
				}
				this.errCode = json.getInt("errcode");
				this.errMsg = json.getString("errmsg");
			} catch (Exception e) {
				this.localRetCode = LocalRetCode.ERR_JSON;
			}
		}
	}

	private enum LocalRetCode {
		ERR_OK,
		ERR_HTTP,
		ERR_JSON,
		ERR_OTHER;
		//
		// static {
		// ERR_OK = new LocalRetCode("ERR_OK", 0);
		// ERR_HTTP = new LocalRetCode("ERR_HTTP", 1);
		// ERR_JSON = new LocalRetCode("ERR_JSON", 2);
		// ERR_OTHER = new LocalRetCode("ERR_OTHER", 3);
		// ENUM$VALUES = new LocalRetCode[] { ERR_OK, ERR_HTTP, ERR_JSON,
		// ERR_OTHER };
		// }
	}

	private class MyAdapter extends BaseAdapter {
		private Context context;
		private List<MemberYouHui> list;

		public MyAdapter(Context context) {
			this.context = context;
		}

		public void setList(List<MemberYouHui> list) {
			this.list = list;
		}

		@Override
		public int getCount() {
			return this.list == null ? 0 : this.list.size();
		}

		@Override
		public long getItemId(int position) {
			return position;
		}

		@Override
		public Object getItem(int position) {
			return this.list == null ? null : (MemberYouHui) this.list.get(position);
		}

		@Override
		public View getView(int position, View convertView, ViewGroup parent) {
			ViewHolder viewHolder;
			if (convertView == null) {
				convertView = LinearLayout.inflate(this.context, R.layout.simple_member_type_item, null);
				viewHolder = new ViewHolder();
				viewHolder.ll = (LinearLayout) convertView.findViewById(R.id.ll_member_youhui);
				viewHolder.tv_content = (TextView) convertView.findViewById(R.id.tv_member_youhui_content);
				viewHolder.tv_title = (TextView) convertView.findViewById(R.id.tv_member_youhui_title);
				viewHolder.img = (ImageView) convertView.findViewById(R.id.img_member_youhui);
				convertView.setTag(viewHolder);
			} else {
				viewHolder = (ViewHolder) convertView.getTag();
			}
			if (position > 1) {
				viewHolder.ll.setBackgroundResource(R.color.white);
			} else if (MemberDetailActivity.this.memberType == 1) {
				viewHolder.ll.setBackgroundResource(R.drawable.experience_bg);
			} else if (MemberDetailActivity.this.memberType == 2) {
				viewHolder.ll.setBackgroundResource(R.drawable.general_bg);
			} else if (MemberDetailActivity.this.memberType == 3) {
				viewHolder.ll.setBackgroundResource(R.drawable.silver_bg);
			} else if (MemberDetailActivity.this.memberType == 4) {
				viewHolder.ll.setBackgroundResource(R.drawable.gold_bg);
			}
			MemberYouHui memberYouHui = this.list.get(position);
			viewHolder.tv_title.setText(memberYouHui.getTitle());
			viewHolder.tv_content.setText(memberYouHui.getContent());
			viewHolder.img.setImageResource(memberYouHui.getImg());
			return convertView;
		}
	}

	private class ViewHolder {
		ImageView img;
		LinearLayout ll;
		TextView tv_content;
		TextView tv_title;

		private ViewHolder() {
		}
	}

	public MemberDetailActivity() {
		this.payType = 0;
		this.is_open_close = false;
		this.handler = new Handler() {
			@Override
			public void handleMessage(Message msg) {
				switch (msg.what) {
				case RQF_PAY /* 290 */:
					Result.sResult = (String) msg.obj;
					if (Result.isSucc()) {
						MainToast.show(MemberDetailActivity.this, "\u5145\u503c\u6210\u529f", 0);
						AppShareData.isPersonFrag = true;
						if (MemberDetailActivity.this.ispayprompty) {
							MemberDetailActivity.this.setResult(-1);
							MemberDetailActivity.this.finish();
							return;
						}
						MemberDetailActivity.this.startActivity(new Intent(MemberDetailActivity.this, MainTWo.class));
						return;
					}
					MainToast.show(MemberDetailActivity.this, "\u652f\u4ed8\u672a\u6210\u529f", 0);
				default:
				}
			}
		};
	}

	static {
		code = -10000;
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_member_detail);
		this.api = WXAPIFactory.createWXAPI(this, Constants.APP_ID, false);
		this.api.registerApp(Constants.APP_ID);
		this.bu = BitmapUtilHelper.createBitmapUtil(this);
		this.cusProDialog = new CusProSmallBgDialog(this);
		this.ispayprompty = getIntent().getBooleanExtra("ispayprompty", false);
		this.id = getIntent().getStringExtra("id");
		if (this.id == null || this.id.length() <= 0 || Integer.parseInt(this.id) == 0) {
			this.memberTypee = (MemberTypee) getIntent().getSerializableExtra("memberTypee");
			this.memberType = Integer.parseInt(this.memberTypee.getDegree());
			initView();
			initData();
			return;
		}
		getMemberTypee();
	}

	private void getMemberTypee() {
		if (CheckUtil.checkNet(this)) {
			NetUtil.get(this, Constant.MEMBER_LIST, 100, new RequestCallBack<String>() {
				@Override
				public void onSuccess(ResponseInfo<String> responseInfo) {
					try {
						JSONObject jsonObject = new JSONObject(NetUtil.unescapeUnicode(responseInfo.result));
						if (jsonObject.getInt("code") == 10000) {
							int i;
							List<MemberTypee> list = new ArrayList();
							JSONArray jsonArray = jsonObject.getJSONArray("data");
							for (i = 0; i < jsonArray.length(); i++) {
								JSONObject object = jsonArray.getJSONObject(i);
								MemberTypee memberTypee = new MemberTypee();
								memberTypee.parseJson(object);
								list.add(memberTypee);
							}
							for (i = 0; i < list.size(); i++) {
								if (Integer.parseInt(MemberDetailActivity.this.id) == Integer.parseInt(list.get(i)
										.getDegree())) {
									MemberDetailActivity.this.memberTypee = list.get(i);
								}
							}
							MemberDetailActivity.this.memberType = Integer
									.parseInt(MemberDetailActivity.this.memberTypee.getDegree());
							MemberDetailActivity.this.initView();
							MemberDetailActivity.this.initData();
							return;
						}
						MainToast.show(MemberDetailActivity.this, jsonObject.getString("error"), 0);
					} catch (JSONException e) {
						e.printStackTrace();
						MainToast.show(MemberDetailActivity.this,
								MemberDetailActivity.this.getResources().getString(R.string.app_error), 0);
					}
				}

				@Override
				public void onFailure(HttpException arg0, String arg1) {
					MainToast.show(MemberDetailActivity.this,
							MemberDetailActivity.this.getResources().getString(R.string.netFail), 0);
				}
			});
		} else {
			MainToast.show(this, getResources().getString(R.string.txt_network), 0);
		}
	}

	private void initData() {
		this.tv_title.setText(new StringBuilder(String.valueOf(this.memberTypee.getName())).append("\u8be6\u60c5")
				.toString());
		if (this.memberType == 1) {
			this.rl_bg.setBackgroundResource(R.drawable.per_experience_vip);
			initData1();
		} else if (this.memberType == 2) {
			this.rl_bg.setBackgroundResource(R.drawable.general_vip);
			initData2();
		} else if (this.memberType == 3) {
			this.rl_bg.setBackgroundResource(R.drawable.per_silver_card);
			initData3(this.is_open_close);
		} else if (this.memberType == 4) {
			this.rl_bg.setBackgroundResource(R.drawable.per_gold_card);
			initData4(this.is_open_close);
		}
		this.bu.display(this.img_member_kapian, this.memberTypee.getImg3());
		initAdapter();
	}

	private void initAdapter() {
		this.myAdapter.setList(this.lists);
		this.myAdapter.notifyDataSetChanged();
	}

	private void initData4(boolean isopen) {
		this.lists = new ArrayList();
		if (isopen) {
			this.lists.add(new MemberYouHui(2130837601, "\u5c0a\u4eab\u91d1\u5361",
					"\u4e13\u5458\u4e0a\u95e8\u9001\u4e0a\u4e2a\u6027\u5c0a\u8d35\u91d1\u5361"));
			this.lists
					.add(new MemberYouHui(2130837593, "\u7ebf\u4e0b\u798f\u5229",
							"\u60a8\u5c06\u6210\u4e3a\u7231\u5927\u53a8\u7ebf\u4e0b\u6d3b\u52a8\u7684\u7b2c\u4e00\u9080\u8bf7\u5bf9\u8c61"));
			this.lists
					.add(new MemberYouHui(2130837864, "\u5ba2\u670d\u4e13\u7ebf",
							"\u4e13\u7ebf\u5ba2\u670d\u4f18\u5148\u63a5\u5f85\uff0c\u5c0a\u4eab\u5168\u9762\u8d34\u5fc3\u670d\u52a1"));
			this.lists.add(new MemberYouHui(2130837595, "\u5168\u57ce\u70ed\u53a8",
					"\u9884\u7ea6\u4e0d\u53d7\u8ddd\u79bb\u9650\u5236\uff0c\u5c3d\u4eab\u5168\u57ce\u53a8\u5e08"));
			this.lists.add(new MemberYouHui(2130837599, "\u65b0\u54c1\u4f18\u4eab",
					"\u7b2c\u4e00\u65f6\u95f4\u4eab\u53d7\u7231\u5927\u53a8\u65b0\u54c1\u670d\u52a1"));
			this.lists
					.add(new MemberYouHui(2130837579, "\u4f18\u9009\u7279\u60e0",
							"\u4f1a\u5458\u4e13\u4eab\u7231\u5927\u53a8\u5408\u4f5c\u4f19\u4f34\u751f\u9c9c\u98df\u6750\u6298\u6263"));
			this.lists
					.add(new MemberYouHui(2130837597, "\u795e\u79d8\u793c\u7269",
							"\u4f1a\u5458\u5c06\u4e0d\u5b9a\u671f\u6536\u5230\u7231\u5927\u53a8\u7684\u795e\u79d8\u793c\u54c1"));
			this.lists.add(new MemberYouHui(2130837598, "\u72ec\u7279\u6807\u793a",
					"\u6839\u636e\u4f1a\u5458\u7ea7\u522b\u5f70\u663e\u4f1a\u5458\u5c0a\u8d35\u8eab\u4efd"));
			return;
		}
		this.lists.add(new MemberYouHui(2130837601, "\u5c0a\u4eab\u91d1\u5361",
				"\u4e13\u5458\u4e0a\u95e8\u9001\u4e0a\u4e2a\u6027\u5c0a\u8d35\u91d1\u5361"));
		this.lists
				.add(new MemberYouHui(2130837593, "\u7ebf\u4e0b\u798f\u5229",
						"\u60a8\u5c06\u6210\u4e3a\u7231\u5927\u53a8\u7ebf\u4e0b\u6d3b\u52a8\u7684\u7b2c\u4e00\u9080\u8bf7\u5bf9\u8c61"));
		this.lists
				.add(new MemberYouHui(2130837864, "\u5ba2\u670d\u4e13\u7ebf",
						"\u4e13\u7ebf\u5ba2\u670d\u4f18\u5148\u63a5\u5f85\uff0c\u5c0a\u4eab\u5168\u9762\u8d34\u5fc3\u670d\u52a1"));
		this.lists.add(new MemberYouHui(2130837595, "\u5168\u57ce\u70ed\u53a8",
				"\u9884\u7ea6\u4e0d\u53d7\u8ddd\u79bb\u9650\u5236\uff0c\u5c3d\u4eab\u5168\u57ce\u53a8\u5e08"));
	}

	private void initData3(boolean isopen) {
		this.lists = new ArrayList();
		if (isopen) {
			this.lists
					.add(new MemberYouHui(2130837600, "\u5ba2\u670d\u4e13\u7ebf",
							"\u4e13\u7ebf\u5ba2\u670d\u4f18\u5148\u63a5\u5f85\uff0c\u5c0a\u4eab\u5168\u9762\u8d34\u5fc3\u670d\u52a1"));
			this.lists.add(new MemberYouHui(2130837863, "\u5168\u57ce\u70ed\u53a8",
					"\u9884\u7ea6\u4e0d\u53d7\u8ddd\u79bb\u9650\u5236\uff0c\u5c3d\u4eab\u5168\u57ce\u53a8\u5e08"));
			this.lists.add(new MemberYouHui(2130837599, "\u65b0\u54c1\u4f18\u4eab",
					"\u7b2c\u4e00\u65f6\u95f4\u4eab\u53d7\u7231\u5927\u53a8\u65b0\u54c1\u670d\u52a1"));
			this.lists
					.add(new MemberYouHui(2130837579, "\u4f18\u9009\u7279\u60e0",
							"\u4f1a\u5458\u4e13\u4eab\u7231\u5927\u53a8\u5408\u4f5c\u4f19\u4f34\u751f\u9c9c\u98df\u6750\u6298\u6263"));
			this.lists
					.add(new MemberYouHui(2130837597, "\u795e\u79d8\u793c\u7269",
							"\u4f1a\u5458\u5c06\u4e0d\u5b9a\u671f\u6536\u5230\u7231\u5927\u53a8\u7684\u795e\u79d8\u793c\u54c1"));
			this.lists.add(new MemberYouHui(2130837598, "\u72ec\u7279\u6807\u793a",
					"\u6839\u636e\u4f1a\u5458\u7ea7\u522b\u5f70\u663e\u4f1a\u5458\u5c0a\u8d35\u8eab\u4efd"));
			return;
		}
		this.lists
				.add(new MemberYouHui(2130837600, "\u5ba2\u670d\u4e13\u7ebf",
						"\u4e13\u7ebf\u5ba2\u670d\u4f18\u5148\u63a5\u5f85\uff0c\u5c0a\u4eab\u5168\u9762\u8d34\u5fc3\u670d\u52a1"));
		this.lists.add(new MemberYouHui(2130837863, "\u5168\u57ce\u70ed\u53a8",
				"\u9884\u7ea6\u4e0d\u53d7\u8ddd\u79bb\u9650\u5236\uff0c\u5c3d\u4eab\u5168\u57ce\u53a8\u5e08"));
		this.lists.add(new MemberYouHui(2130837599, "\u65b0\u54c1\u4f18\u4eab",
				"\u7b2c\u4e00\u65f6\u95f4\u4eab\u53d7\u7231\u5927\u53a8\u65b0\u54c1\u670d\u52a1"));
		this.lists
				.add(new MemberYouHui(2130837579, "\u4f18\u9009\u7279\u60e0",
						"\u4f1a\u5458\u4e13\u4eab\u7231\u5927\u53a8\u5408\u4f5c\u4f19\u4f34\u751f\u9c9c\u98df\u6750\u6298\u6263"));
	}

	private void initData2() {
		this.lists = new ArrayList();
		this.lists.add(new MemberYouHui(2130837580, "\u65b0\u54c1\u4f18\u4eab",
				"\u7b2c\u4e00\u65f6\u95f4\u4eab\u53d7\u7231\u5927\u53a8\u65b0\u54c1\u670d\u52a1"));
		this.lists
				.add(new MemberYouHui(2130837596, "\u4f18\u9009\u7279\u60e0",
						"\u4f1a\u5458\u4e13\u4eab\u7231\u5927\u53a8\u5408\u4f5c\u4f19\u4f34\u751f\u9c9c\u98df\u6750\u6298\u6263"));
		this.lists.add(new MemberYouHui(2130837597, "\u795e\u79d8\u793c\u7269",
				"\u4f1a\u5458\u5c06\u4e0d\u5b9a\u671f\u6536\u5230\u7231\u5927\u53a8\u7684\u795e\u79d8\u793c\u54c1"));
		this.lists.add(new MemberYouHui(2130837598, "\u72ec\u7279\u6807\u793a",
				"\u6839\u636e\u4f1a\u5458\u7ea7\u522b\u5f70\u663e\u4f1a\u5458\u5c0a\u8d35\u8eab\u4efd"));
	}

	private void initData1() {
		this.lists = new ArrayList();
		this.lists.add(new MemberYouHui(2130837591, "\u795e\u79d8\u793c\u7269",
				"\u4f1a\u5458\u5c06\u4e0d\u5b9a\u671f\u6536\u5230\u7231\u5927\u53a8\u7684\u795e\u79d8\u793c\u54c1"));
		this.lists.add(new MemberYouHui(2130837808, "\u72ec\u7279\u6807\u793a",
				"\u6839\u636e\u4f1a\u5458\u7ea7\u522b\u5f70\u663e\u4f1a\u5458\u5c0a\u8d35\u8eab\u4efd"));
	}

	private void initView() {
		this.rl_bg = (RelativeLayout) findViewById(R.id.rl_bg);
		this.tv_title = (TextView) findViewById(R.id.tv_title);
		this.btn_back = (Button) findViewById(R.id.btn_back);
		this.btn_back.setOnClickListener(this);
		this.ll_weixin = (LinearLayout) findViewById(R.id.ll_weixin);
		this.ll_weixin.setOnClickListener(this);
		this.ll_alipay = (LinearLayout) findViewById(R.id.ll_alipay);
		this.ll_alipay.setOnClickListener(this);
		this.img_weixin = (ImageView) findViewById(R.id.img_weixin);
		this.img_alipay = (ImageView) findViewById(R.id.img_alipay);
		this.btn_ok = (Button) findViewById(R.id.btn_ok);
		this.btn_ok.setOnClickListener(this);
		this.mlv_main = (MyListView) findViewById(R.id.mlv_main);
		this.myAdapter = new MyAdapter(this);
		this.mlv_main.setAdapter(this.myAdapter);
		this.ll_member_on_off = (LinearLayout) findViewById(R.id.ll_member_on_off);
		this.ll_member_on_off.setOnClickListener(this);
		this.img_member_kapian = (ImageView) findViewById(R.id.img_member_kapian);
		if (this.memberType == 1 || this.memberType == 2) {
			this.ll_member_on_off.setVisibility(BitmapCacheManagementTask.MESSAGE_CLEAR_MEMORY_BY_KEY);
		}
		this.img_member_on_off = (ImageView) findViewById(R.id.img_member_on_off);
		this.tv_youhui_price = (TextView) findViewById(R.id.tv_youhui_price);
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.btn_back /* 2131165198 */:
			finish();
		case R.id.ll_weixin /* 2131165204 */:
			ImgPayType(this.img_weixin);
			this.payType = 0;
		case R.id.ll_member_on_off /* 2131165336 */:
			if (this.is_open_close) {
				this.is_open_close = false;
				this.img_member_on_off.setImageResource(R.drawable.img_member_close);
				initData();
				return;
			}
			this.is_open_close = true;
			this.img_member_on_off.setImageResource(R.drawable.img_member_open);
			initData();
		case R.id.ll_alipay /* 2131165340 */:
			ImgPayType(this.img_alipay);
			this.payType = 1;
		case R.id.btn_ok /* 2131165342 */:
			if (PrefUtil.getInstance(this).getUID() == null) {
				MainToast.show(this, "\u8bf7\u5148\u767b\u5f55", 0);
				startActivity(new Intent(this, LoginActivity.class));
			} else if (this.payType == 0) {
				payWeixin();
			} else if (this.payType == 1) {
				payWithAlipay();
			}
		default:
		}
	}

	private void ImgPayType(ImageView img) {
		this.img_weixin.setImageResource(R.drawable.icon_select);
		this.img_alipay.setImageResource(R.drawable.icon_select);
		img.setImageResource(R.drawable.icon_select_p);
	}

	@Override
	protected void onResume() {
		if (code == 0) {
			MainToast.show(this, "\u5145\u503c\u6210\u529f", 0);
			AppShareData.isPersonFrag = true;
			code = -10000;
			PayPromptlyActivity.code = -10000;
			if (this.ispayprompty) {
				setResult(-1);
				finish();
			} else {
				startActivity(new Intent(this, MainTWo.class));
			}
		} else if (code != -10000) {
			MainToast.show(this, "\u652f\u4ed8\u672a\u6210\u529f", 0);
			code = -10000;
			PayPromptlyActivity.code = -10000;
		}
		super.onResume();
	}

	private void payWithAlipay() {
		this.cusProDialog.show();
		NetUtil.get(this, new StringBuilder(Constant.PAYMEMBERRECHARGE).append(this.memberType).append("/alipay")
				.toString(), 100, new RequestCallBack<String>() {
			@Override
			public void onSuccess(ResponseInfo<String> responseInfo) {
				MemberDetailActivity.this.cusProDialog.dismiss();
				try {
					JSONObject jsonObject = new JSONObject(NetUtil.unescapeUnicodealipay(responseInfo.result));
					if (jsonObject.getInt("code") == 10000) {
						MemberDetailActivity.this.payAlipayYes(jsonObject.optString("data"));
					} else {
						MainToast.show(MemberDetailActivity.this, jsonObject.optString("error"), 0);
					}
				} catch (JSONException e) {
					e.printStackTrace();
					MainToast.show(MemberDetailActivity.this,
							MemberDetailActivity.this.getResources().getString(R.string.app_error), 0);
				}
			}

			@Override
			public void onFailure(HttpException arg0, String arg1) {
				MemberDetailActivity.this.cusProDialog.dismiss();
				MainToast.show(MemberDetailActivity.this,
						MemberDetailActivity.this.getResources().getString(R.string.netFail), 0);
			}
		});
	}

	private void payAlipayYes(String info) {
		new AnonymousClass_4(info).start();
	}

	private void payWeixin() {
		this.cusProDialog.show();
		NetUtil.get(this, new StringBuilder(Constant.PAYMEMBERRECHARGE).append(this.memberType).append("/weixin")
				.toString(), 100, new RequestCallBack<String>() {
			@Override
			public void onSuccess(ResponseInfo<String> responseInfo) {
				MemberDetailActivity.this.cusProDialog.dismiss();
				try {
					JSONObject jsonObject = new JSONObject(NetUtil.unescapeUnicode(responseInfo.result));
					if (jsonObject.getInt("code") == 10000) {
						GetPrepayIdResult results = new GetPrepayIdResult();
						results.parseFrom(responseInfo.result);
						MemberDetailActivity.this.sendPayReq(results);
						return;
					}
					MainToast.show(MemberDetailActivity.this, jsonObject.optString("error"), 0);
				} catch (JSONException e) {
					e.printStackTrace();
					MainToast.show(MemberDetailActivity.this,
							MemberDetailActivity.this.getResources().getString(R.string.app_error), 0);
				}
			}

			@Override
			public void onFailure(HttpException arg0, String arg1) {
				MemberDetailActivity.this.cusProDialog.dismiss();
				MainToast.show(MemberDetailActivity.this,
						MemberDetailActivity.this.getResources().getString(R.string.netFail), 0);
			}
		});
	}

	private void sendPayReq(GetPrepayIdResult result) {
		PayReq req = new PayReq();
		req.appId = Constants.APP_ID;
		req.partnerId = Constants.PARTNER_ID;
		req.prepayId = result.prepayId;
		req.nonceStr = result.noncestr;
		req.timeStamp = result.timestamp;
		req.packageValue = "Sign=WXPay";
		req.sign = result.sign;
		this.api.sendReq(req);
	}
}